package com.douqu.game.core.entity.ext.data.challenge;

import com.bean.core.buffer.ByteBuffer;
import com.douqu.game.core.entity.EntityObject;

/**
 * @author: Gavin.
 * Description:
 * Date: 2018/7/5 0005 下午 6:28
 * Huan Yu Copyright (c) 2017 All Rights Reserved.
 */
public class HegemonyResultObject extends EntityObject{

    private String title;

    private int num;

    private int score;

    public void loadFrom(ByteBuffer buffer)
    {
        title = buffer.readUTF();
        num = buffer.readInt();
        score = buffer.readInt();
    }

    public void writeTo(ByteBuffer buffer)
    {
        buffer.writeUTF(title);
        buffer.writeInt(num);
        buffer.writeInt(score);
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public void addNum(){
        num += 1;
    }

    public void addScore(int value){
        score += value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        HegemonyResultObject that = (HegemonyResultObject) o;

        if (title != null ? !title.equals(that.title) : that.title != null) return false;

        return true;
    }
}
